<template>
	<view class="container">
		<view class="regtxt">密码设置</view>
		<view class="input-box">
			<input type="text" placeholder="请输入新密码" maxlength="11" v-model="password" password class="input-style" />
			<input type="text" placeholder="请再次输入新密码" maxlength="11" v-model="passwordCom" password class="input-style" />
		</view>
		<view class="next" @click="toThree">提交</view>
	</view>
</template>

<script>
	import md5 from "md5"
	export default {
		data() {
			return {
				password:'',
				passwordCom:'',
				form:{}
			}
		},
		onShow() {
			this.form=uni.getStorageSync('regForm')
		},
		methods:{
			toThree() {
				if(this.password && this.passwordCom) {
					if(this.password == this.passwordCom) {
						this.form.password = md5(this.password)
					 	uni.setStorageSync('regForm',this.form)
						console.log(uni.getStorageSync('regForm'))
						this.$utils.navto('./registerThree')
					}else {
						uni.showToast({
							title:'密码不一致',
							icon:'none',
						})
					}
				}else {
					uni.showToast({
						title:'请输入密码',
						icon:'none',
					})
				}
				
			}
		}
	}
</script>

<style scoped>
.container {
	width: 92%;
	margin: 30upx auto;
	box-sizing: border-box;
}
.regtxt {
	font-size: 60upx;
	font-weight: bold;
	text-align: left;
	margin-bottom: 100upx;
	margin-top: 40upx;
}
.input-box {
	width: 100%;
	box-sizing: border-box;
}
.input-style {
	width: 100%;
	border-bottom: 1px solid #EAEAEA;
	padding: 20upx 0upx;
}
.code-box {
	display: flex;
	justify-content: space-between;
	align-items: center;
	width: 100%;
	font-size: 28upx;
	border-bottom: 1px solid #EAEAEA;
	padding: 20upx 0upx;
}
.next {
	width: 100%;
	text-align: center;
	padding: 20upx 0upx;
	color: #FFFFFF;
	background-color: #345AD4;
	font-size: 28upx;
	margin: 20upx 0upx;
	border-radius: 10upx;
}
.answer {
	width: 100%;
	color: #909090;
	font-size: 24upx;
	text-align: right;
}
.codetxt {
	color: #345AD4;
}
</style>
